/**
 * Copyright 2011 Poltman.Ltd; www.poltman.com. All rights reserved.		
 *
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */

package com.poltman.dscentral.db.repository.dspace;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.poltman.dscentral.db.entity.dspace.HandleEntity;




/**
 * 
 * @author Zbigniew Ciok; z.ciok@poltman.com
 * 
 * @version $Revision: 1806 $
 *
 */
public interface HandleRepository extends JpaRepository<HandleEntity, Integer> {
	
	public HandleEntity findByResourceTypeIdAndResourceId(Integer resourceTypeId, Integer resourceId);
	
	public HandleEntity save(HandleEntity handleEntity);
	
	@Modifying
	@Query("update HandleEntity h set h.handle = ?1 where h.handleId = ?2")
	public int setFixedHandleFor(String handle, Integer handleId);	
	

}
